﻿
<div class="modal-header">
    <button type="button" class="close" ng-disabled="loadingState" ng-click="close();"><span aria-hidden="true">&times;</span></button>
    <h3 class="modal-title">
        <i class="fa fa-users"></i>
        {{headerText}}
        <small ng-show="result">
            共{{studentCount}}人
        </small>
    </h3>
</div>

<div class="modal-body">
    <div ng-hide="result">
        <form id="buildForm" role="form" class="form-horizontal">
            <div class="form-group">
                <label class="col-sm-4 control-label" for="count">生成个数：</label>

                <div class="col-sm-6">
                    <input type="number" class="form-control input-inline" id="count" name="count" ng-model="count" placeholder="请输入生成个数" ng-disabled="loadingState" maxlength="3" />
                </div>
            </div>
        </form>
    </div>

    <div ng-show="result">
        <div class="row">
            <div class="col-sm-10 col-sm-offset-1">
                <table class="table">
                    <thead>
                        <tr class="active">
                            <th class="text-center">#</th>
                            <th>准考证号</th>
                            <th>考生账号</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr ng-repeat="item in list">
                            <td class="text-center">{{$index+1}}</td>
                            <td>{{item.examCardNo}}</td>
                            <td>{{item.examineeName}}</td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>

<div class="modal-footer">
    <button class="btn btn-turquoise" ng-click="build();" ng-disabled="loadingState" ng-hide="result">
        <i ng-show="loadingState" class="fa fa-spinner fa-spin"></i>
        <i ng-hide="loadingState" class="fa fa-check"></i>
        生成
    </button>
    <button class="btn btn-gray" ng-click="close();" ng-disabled="loadingState">
        <i class="fa fa-close"></i>
        关闭
    </button>
</div>

<script>
    $(function () {
        $('form#buildForm').validate({
            rules: {
                prefix: {
                    required: true
                },
                count: {
                    required: true,
                    digits: true,
                    number: true,
                    range: [1, 999]
                }
            },
            messages: {
                prefix: {
                    required: '请输入账号前缀！'
                },
                count: {
                    required: '请输入考生个数！',
                    digits: '请输入整数个数！',
                    number: '请输入整数个数！',
                    range: '请输入{0}到{1}之间的考生个数！'
                }
            }
        });
    });
</script>
